﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using ZeroSum.Authentication.JwtBearer.Authorization;
using ZeroSum.DependencyInjection.Attributes;
using ZeroSum.DependencyInjection.Interfaces;

namespace ZeroSumDBM.Core;

/// <summary>
///     Identity层初始化注册，要早于AspNetCore
///     晚于Domain, Infrastructure, Application
/// </summary>
[StartupOrder(1001)]
public class Startup : IAppStartup
{
    public void ConfigurationServices(IServiceCollection services, IConfiguration configuration)
    {
        // 注册授权相关服务的实现
        services.AddTransient<IRoleDomainService, RoleDomainService>();
        services.AddTransient<IUserDomainService, UserDomainService>();
        services.AddTransient<IMenuDomainService, MenuDomainService>();

        services.AddDistributedMemoryCache();

        services.AddScoped<IZeroSumAuthorization, ZeroSumAuthorization>();
    }

    public void Configuration(IApplicationBuilder app)
    {

    }
}